package com.weishu.housing.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.weishu.common.core.utils.DateUtils;
import com.weishu.common.core.utils.StringUtils;
import com.weishu.common.core.web.domain.AjaxResult;
import com.weishu.common.security.annotation.PreAuthorize;
import com.weishu.core.entity.CfContract;
import com.weishu.core.entity.RoomInfoEntity;
import com.weishu.core.entity.SfContract;
import com.weishu.core.entity.SfTermination;
import com.weishu.core.service.ICfContractService;
import com.weishu.core.service.ISfContractService;
import com.weishu.core.service.ISfTerminationService;
import com.weishu.core.service.ITbRoomInfoService;
import com.weishu.housing.service.FangyuanEs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * 房源列表
 */
@RestController
@RequestMapping("/house")
public class RoomInfoController {

    @Autowired
    private ITbRoomInfoService iTbRoomInfoService;

    @Resource
    private FangyuanEs fangyuanEs;





    /**
     * @author xupeng
     * @param roomInfoEntity
     * @param pageNo
     * @param pageSize
     * @return
     */
    //房源列表
    //rxh修改权限
   // @PreAuthorize(hasPermi = "hourse:house:list")
    @RequestMapping("list")
    public AjaxResult s1(RoomInfoEntity roomInfoEntity, Integer pageNo, Integer pageSize) {
        //List<TbRoomInfo> tbRoomInfos = tbRoomInfoMapper.selectList(null);
        //List<RoomInfoEntity> tbRoomInfos1 = iTbRoomInfoService.queryList(roomInfoEntity);
      /*PageHelper.startPage(pageNo, pageSize);
      PageInfo<RoomInfoEntity> pageInfo=new PageInfo<>(tbRoomInfos1);*/
        AjaxResult fangyuanquery = fangyuanEs.fangyuanquery(roomInfoEntity, pageNo, pageSize);
        Object data = fangyuanquery.get("data");
        System.out.println(data.toString());
        return fangyuanquery;
    }


    @PostConstruct
    public void jiazaiEs(){
        fangyuanEs.FangyuanGetEsAll();
    }












}
